package com.gome.gop.common;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
//import com.dell.dragon.beans.inventory.WSInventoryRetVO;
//import com.dell.dragonfx.transferobjects.po.POImportWsVODetail;
//import com.dell.dragonfx.transferobjects.po.POImportWsVOHeader;
//import com.dell.dragonfx.transferobjects.webservice.CancelBeforeExVo;
//import com.dell.dragonfx.transferobjects.webservice.OrdRemarkVo;
//import com.dell.dragonfx.transferobjects.webservice.AsnCancelVo;
//import com.dell.dragonfx.webservice.converter.DateConverter;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.basic.DateConverter;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;

public abstract class WarehouseBaseVO implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private static XStream xs = new XStream(new DomDriver("UTF-8", (new XmlFriendlyNameCoder("-_", "_"))));
	
	protected static List<Class> classList = new ArrayList<Class>();
	
	static{
//		classList.add(WarehouseExitHVO.class);
//		classList.add(WarehouseExitDetailVO.class);
//    	classList.add(InventorySearchVO.class);
		classList.add(MasterPartVo.class);
//		classList.add(CancelBeforeExVo.class);
//		classList.add(InvReturnResp.class);
//		classList.add(WSInventoryRetVO.class);
//		classList.add(WarehouseResp.class);
//		classList.add(POImportWsVOHeader.class);
//		classList.add(POImportWsVODetail.class);
//		classList.add(AsnCancelVo.class);
//		classList.add(OrdRemarkVo.class);
		
		
		xs.registerConverter(new DateConverter());
		xs.autodetectAnnotations(true);
		for (Class cls : classList)
			xs.processAnnotations(cls);

	}
	

	public static <T extends WarehouseBaseVO> T fromXml(String xml) {
		return (T) xs.fromXML(xml);
	}
	
	public String toXml() {
		return xs.toXML(this);
	}
	
}
